import Vue from 'vue'
import Router from 'vue-router'
import Login from '../views/login/login.vue'
import Layout from '../views/layout/index.vue'
import AppMain from "@/views/layout/AppMain";
const _import = (file) => require('@/views/' + file + '.vue').default

Vue.use(Router)

export const constantRouterMap = [{
    path: '/',
    name: 'Login',
    component: Login
  },
  {
    path: "/login",
    name: "首页",
    component: _import("login/login"),
  },
  {
    path: "/home",
    name: "首页",
    component: Layout,
    icon: 'icon-1',
    children: [{
      path: "/home",
      name: "首页",
      component: _import("homepage/index"),
    }]
  },
  {
    path: "/home",
    name: "首页",
    component: Layout,
    icon: 'icon-1',
    children: [{
      path: "/home/profile",
      name: "概况",
      component: _import("homepage/profile"),
    }, {
      path: "/home/historydif",
      name: "历史差异",
      component: _import("homepage/historydif"),
    }, {
      path: "/home/sectiondif",
      name: "学段差异",
      component: _import("homepage/sectiondif"),
    }, {
      path: "/home/schooldif",
      name: "学校差异",
      component: _import("homepage/schooldif"),
    }, {
      path: "/home/gradedif",
      name: "年级差异",
      component: _import("homepage/gradedif"),
    }]
  },
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

export const asyncRouterMap = [{
		path: "/evaluate",
		name: "综合评价",
		component: Layout,
		redirect: '/evaluate/index',
		icon: 'icon-2',
		children: [{
			path: "/evaluate/index",
			name: "综合评价",
			component: _import("evaluate/index"),
		}]
	},
	{
		path: "/reporting",
		name: "材料填报",
		component: Layout,
		redirect: '/reporting/index',
		icon: 'icon-3',
		children: [{
			path: "/reporting/index",
			name: "材料填报",
			component: _import("reporting/index"),
		}]
	},
	{
		path: "/expert",
		name: "专家打分",
		component: Layout,
		redirect: '/expert/index',
		icon: 'icon-9',
		children: [{
			path: "/expert/index",
			name: "专家打分",
			component: _import("expert/index"),
		}]
	},
	{
		path: "/accomplishment",
		name: "学业素养",
		component: Layout,
		icon: 'icon-4',
		children: [{
			path: "/accomplishment/index",
			name: "学业分析",
			component: _import("accomplishment/index"),
		}, {
			path: "/accomplishment/questions",
			name: "试题分析",
			component: _import("accomplishment/questions"),
		}, {
			path: "/accomplishment/point",
			name: "知识点分析",
			component: _import("accomplishment/point"),
		}, {
			path: "/accomplishment/ability",
			name: "能力分析",
			component: _import("accomplishment/ability"),
		}, {
			path: "/accomplishment/burden",
			name: "学业负担",
			component: AppMain,
			redirect: '/accomplishment/burden/profile',
			// component: _import("accomplishment/burden"),
			children: [{
				path: "/accomplishment/burden/profile",
				name: "概况",
				component: _import("accomplishment/burden/profile"),
			}, {
				path: "/accomplishment/burden/historydif",
				name: "历史差异",
				component: _import("accomplishment/burden/historydif"),
			}, {
				path: "/accomplishment/burden/questdetail",
				name: "问卷详情",
				component: _import("accomplishment/burden/questdetail"),
			}, {
				path: "/accomplishment/burden/schoolanalysis",
				name: "学校分析",
				component: _import("accomplishment/burden/schoolanalysis"),
			}, {
				path: "/accomplishment/burden/dimensionanalysis",
				name: "维度分析",
				component: _import("accomplishment/burden/dimensionanalysis"),
			}, {
				path: "/accomplishment/burden/analysisreport",
				name: "分析报告",
				component: _import("accomplishment/burden/analysisreport"),
			}, ]

		}]
	},
	{
		path: "/analysis",
		name: "分析报告",
		component: Layout,
		icon: 'icon-5',
		children: [{
			path: "/analysis/study",
			name: "学业报告",
			component: _import("analysis/study"),
		}, {
			path: "/analysis/teacher",
			name: "教师报告",
			component: _import("analysis/teacher"),
		}]
	},
	{
		path: "/sysmanage",
		name: "系统管理",
		component: Layout,
		redirect: '/sysmanage/index',
		icon: 'icon-6',
		children: [{
			path: "/sysmanage/index",
			name: "系统管理",
			component: _import("sysmanage/index"),
		}]
	},
	{
		path: "/tablemanage",
		name: "量表管理",
		component: Layout,
		redirect: '/tablemanage/index',
		icon: 'icon-7',
		children: [{
			path: "/tablemanage/index",
			name: "量表管理",
			component: _import("tablemanage/index"),
		}]
	},
	{
		path: "/analysismanage",
		name: "分析管理",
		component: Layout,
		redirect: '/analysismanage/index',
		icon: 'icon-8',
		children: [{
			path: "/analysismanage/index",
			name: "分析管理",
			component: _import("analysismanage/index"),
		}]
	},


];

export default new Router({
	scrollBehavior: () => ({
		y: 0
	}),
	routes: constantRouterMap.concat(asyncRouterMap)
});